<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<load href="__PUBLIC__/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="__CSS__main.css"/>
<link rel="stylesheet" type="text/css" href="__CSS__jquery.datetimepicker.css"/>
<load href="__PUBLIC__/js/jquery-1.9.1.min.js" />
<load href="__PUBLIC__/js/main.js" />
</head>

<body>
<!-- 图片资源开始 -->
<div class="floatBackground" id="floatBackground" style="display: none;">
	<div class="bounced">
	<label class="closeImgResurces">X</label>
	<iframe id="imgResourcesiframe" src="{:rtrim(U('Upload/index'),'.html')}" width="750" height="465" frameborder="0" scrolling="auto"></iframe>
	</div>
</div>
<!-- 图片资源结束 -->
<div class="main-frame">
	<div class="position">直播 > 创建直播</div>
	<div class="addobject">
		<div class="obj-form">
			<form name="form1" id="typeform1" action="{:U('livehandle')}" method="post" class="form-inline">
				<if condition="$edit eq 1">
					<input type="hidden" name="live_id" value="{$liveinfo.id}" />
					<input type="hidden" name="handlytype" value="save" />
				</if>
				<ul>
					<li>
						<label class="fl tle">Domain：</label>
						<span class="fl cnt"><input name="live_domain" class="form-control" placeholder="live_123" value="{$liveinfo.live_domain}" style="width: 100px;"><em>* 用于获取商家商品信息（格式为：live_123）</em></span>
					</li>
					<li>
						<label class="fl tle">直播标题：</label>
						<span class="fl cnt"><input name="live_name" class="form-control" placeholder="直播标题" value="{$liveinfo.live_name}"><em>*</em></span>
					</li>
					<li>
						<label class="fl tle">直播图片：</label>
						<span class="fl cnt"><input name="live_img" id="thumbimg" class="form-control" placeholder="直播图片" value="{$liveinfo.live_img}" style="width: 300px;"><a class="browse" f='thumbimg'>浏览···</a></span>
					</li>
					<if condition="$edit eq 1">
					<li style="margin-top:-15px;">
						<label class="fl tle">&nbsp;</label>
						<span class="fl cnt"><img src="{$liveinfo.live_img}" height="100" /></span>
					</li>
					</if>
					<li>
						<label class="fl tle">视频流地址：</label>
						<span class="fl cnt"><textarea name="live_addres" class="form-control" placeholder="视频流地址" style="width: 450px; height:60px;">{$liveinfo.live_addres}</textarea></span>
					</li>
					<li>
						<label class="fl tle">开始时间：</label>
						<span class="fl cnt"><input id="live_startdate" name="live_startdate" class="txtlength200" placeholder="开始时间" value="<if condition="$edit eq 1">{$liveinfo.live_startdate}</if>"></span>
					</li>
					<li>
						<label class="fl tle">结束时间：</label>
						<span class="fl cnt"><input id="live_enddate" name="live_enddate" class="txtlength200" placeholder="结束时间" value="<if condition="$edit eq 1">{$liveinfo.live_enddate}</if>"></span>
					</li>
					<li>
						<label class="fl tle">观看方式：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="live_way" value="2"<if condition="$liveinfo.live_way eq 2"> checked="checked"</if>> 钻石
							<input class="radio" type="radio" name="live_way" value="1"<if condition="$liveinfo.live_way eq 1"> checked="checked"</if> style="margin-left:12px;"> 现金
						</span>
					</li>
					<li class="lpre" style="display: none;">
						<label class="fl tle">价格：</label>
						<span class="fl cnt"><input name="live_pre" class="txtlength200" placeholder="价格" value="{$liveinfo.live_pre}" style="width:100px;"><em>（不填或者0表示免费）</em></span>
					</li>
					<li class="ldirll" style="display: none;">
						<label class="fl tle">华人钻：</label>
						<span class="fl cnt"><input name="live_dirll" class="txtlength200" placeholder="华人钻" value="{$liveinfo.live_dirll}" style="width:100px;"> 个钻<em>（不填或者0表示免费）</em></span>
					</li>
					<script>
						$(function(){
							var t = $("input[name='live_way']:checked").val();
							chway(t);

							$("input[name='live_way']").each(function(index,element){
								var h = $(this);
								h.click(function(){
									var t1 = ($(this).val());
									chway(t1);
								})
							})
							function chway(t){
								if(t==2){
									$("li.ldirll").show();
									$("li.lpre").hide();
								}else if(t==1){
									$("li.ldirll").hide();
									$("li.lpre").show();
								}else{
									$("li.lpre").hide();
									$("li.ldirll").hide();
								}
							}
						})
					</script>
					<li>
						<label class="fl tle">直播类型：</label>
						<span class="fl cnt">
							<input class="radio" type="radio" name="live_type" value="0"<if condition="$liveinfo.live_type eq 0"> checked="checked"</if>> 录播
							<input class="radio" type="radio" name="live_type" value="1"<if condition="$liveinfo.live_type eq 1"> checked="checked"</if> style="margin-left:12px;"> 直播
						</span>
					</li>
					<script type="text/javascript" charset="utf-8" src="__PUBLIC__/UEditor/ueditor.config.js"></script>
					<script type="text/javascript" charset="utf-8" src="__PUBLIC__/UEditor/ueditor.all.min.js"> </script>
					<script type="text/javascript" charset="utf-8" src="__PUBLIC__/UEditor/lang/zh-cn/zh-cn.js"></script>
					<li>
						<label class="fl tle">直播简介：</label>
                        <span class="fl cnt">
							<textarea name="live_content" id="editor" style="width: 900px; height:350px; overflow: hidden;">{$liveinfo['live_content']}</textarea>
							<script>var ue = UE.getEditor('editor');</script>
						</span>
					</li>
					<li>
						<label class="fl tle">排序：</label>
						<span class="fl cnt"><input name="live_push" class="txtlength200" placeholder="排序" value="{$liveinfo.live_push}" style="width:100px;"></span>
					</li>
					<li>
						<label class="fl tle">商城绑定：</label>
						<span class="fl cnt"><input name="live_bindshoppro" class="txtlength200" placeholder="商城绑定" value="{$liveinfo.live_bindshoppro}" style="width:100px;"></span>
					</li>
					<li class="submit">
						<label class="fl tle">&nbsp;</label>
						<span class="fl cnt">
							<input type="submit" value="确 定" class="submitbtn" />
							<if condition="date('Y-m-d H:i:s') lt $liveinfo['live_startdate']">
								<input type="submit" value="确 定" class="submitbtn" />
							<else />
								<div style="display: none">
								<script>
									$(function(){
										//$("input").attr('disabled','disabled');
										//$("textarea").attr('disabled','disabled');
									})
								</script>
								</div>
							</if> <a href="{:U('Index/main')}">取消并查看列表</a></span>
					</li>
				</ul>
			</form>
		</div>
	</div>

</div>
<script src="__JS__jquery.datetimepicker.full.js"></script>
<script type="text/javascript">
	function getNowFormatDate() {
		var date = new Date();
		var seperator1 = "-";
		var seperator2 = ":";
		var month = date.getMonth() + 1;
		var strDate = date.getDate();
		if (month >= 1 && month <= 9) {
			month = "0" + month;
		}
		if (strDate >= 0 && strDate <= 9) {
			strDate = "0" + strDate;
		}
		var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
				+ " " + date.getHours() + seperator2 + date.getMinutes();
		return currentdate;
	}
	$.datetimepicker.setLocale('zh');
	$('#live_startdate').datetimepicker({value:<if condition="$edit eq 1">'{$liveinfo.live_startdate}'<else />getNowFormatDate()</if>,step:10});
	$('#live_enddate').datetimepicker({value:<if condition="$edit eq 1">'{$liveinfo.live_enddate}'<else />getNowFormatDate()</if>,step:10});
</script>
</body>
</html>
